package com.woniu.product.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.woniu.common.util.ResponseData;
import com.woniu.product.dto.CartDto;
import com.woniu.product.pojo.TShoppingcart;
import com.woniu.product.service.TShoppingcartService;
import com.woniu.product.mapper.TShoppingcartMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
* @author 91211
* @description 针对表【t_shoppingcart】的数据库操作Service实现
* @createDate 2024-05-22 14:44:52
*/
@Service
public class TShoppingcartServiceImpl extends ServiceImpl<TShoppingcartMapper, TShoppingcart>
    implements TShoppingcartService{
    @Autowired TShoppingcartMapper shoppingcartMapper;

    @Override
    public ResponseData<?> getShoppingcart(Long userId) {
        List<CartDto> cartDtos = shoppingcartMapper.getShoppingcart(userId);
        return new ResponseData<>().ok(cartDtos);
    }

    @Override
    public Integer queryCartCount(Integer sortId) {
        return null;
    }

    @Override
    public ResponseData<?> getShopcartItemCount(Long userId) {
        Integer count = shoppingcartMapper.getShopcartItemCount(userId);
        return new ResponseData<>().ok(count);
    }
}




